{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <!--搜索框开始-->
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item">
                            <div class="layui-input-inline">
                                <input type="text"  name="number" id="number"  class="layui-input search" placeholder="订单号" />
                            </div>
                            <div class="layui-input-inline">
                                <input type="text"  name="phone" id="phone" class="layui-input search" placeholder="电话号" />
                            </div>

                            <div class="layui-col-md6 layui-input-inline">
                                <input type="text" id="username" class="layui-input search" name="username" value="" placeholder="用户姓名/店铺名字"/>
                            </div>
                            <div class="layui-input-inline">
                                <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                                <button  class="layui-btn layui-btn-normal" id="empty"  lay-submit="" lay-filter="LAY-search">重置</button>
                            </div>
                        </div>
                </div>
                <!--搜索框结束-->
            </div>
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="demo"></table>
                    <!--图片模板-->
                    <script type="text/html" id="imgTpl">
                        <img src="{{d.user_image}}" class="img-circle table-img" onerror="this.src='/static/admin/images/head_default.gif'"  />
                    </script>
                    <!--角色模板-->
                    <script type="text/html" id="titleTpl">
                        {{# if(d.yy_del == 1){ }}
                            正常
                        {{# }else{ }}
                            已删除
                        {{# } }}
                    </script>
                    <!--状态模板-->
                    <script type="text/html" id="staBar">
                        {{# if(d.yy_status == 1){ }}
                        未确认
                        {{# } }}
                        {{# if(d.yy_status == 2){ }}
                        已确认
                        {{# } }}
                        {{# if(d.yy_status == 3){ }}
                        已完成
                        {{# } }}
                        {{# if(d.yy_status == 4){ }}
                        已取消
                        {{# } }}

                    </script>
                    <!--操作模板-->
                    <!--<script type="text/html" id="opeBar">-->
                        <!--<a href="javascript:;" onclick="wk.href('{:url('userEdit')}')" class="btn btn-primary btn-xs m-r-xs" title="编辑"><i class="fa fa-pencil"></i></a>-->

                    <!--</script>-->
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
        , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("Order/user")}'
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , height: "full-150"
            , cols: [[
                {type: 'checkbox', fixed: 'left',}
                , {type:'numbers', width: 80, title: '序号'}
                , {field: 'yy_number', width: '', title: '订单号', align: 'center'}
                , {field: 'yy_weight', width: '', title: '订单重量', align: 'center'}
                , {field: 'user_username', width: '', title: '用户名称', align: 'center'}
                , {field: 'user_shopname', width: '', title: '店铺名称', align: 'center'}
                , {field: 'user_phone', width: '', title: '用户电话', align: 'center'}
                , {field: 'user_image', width: 90, title: '头像', align: 'center', templet: '#imgTpl'}
                , {field: 'yy_createtime', width: '', title: '订单时间', align: 'center'}
                , {field: 'yy_del', width: '', title: '是否删除', align: 'center', templet: '#titleTpl'}
                , {field: 'yy_status', width: '', title: '订单状态', align: 'center', templet: '#staBar'}
//                , {fixed: 'right', width: 100, title: '操作', align: 'center', toolbar: '#opeBar'}
            ]]
            ,done: function (res, curr, count) {
                $('.img-circle').viewer({
                    url: 'data-original',
                });
            }
        });
        $('.layuiBtn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
        var getIds = function () {
            var ids = [];
            var checkStatus = table.checkStatus('testReload')
                ,data = checkStatus.data;
            $.each(data,function(index,item){
                ids.push(item['id'])
            });
            return ids;
        }
    });
</script>
</body>
</html>